package main
import (
    "fmt"
)

type Man struct {
    name string
    age int
}

func main() {
    x:=3
    fmt.Println("x=",x);
    x1:=add(3)
    fmt.Println("x1 =",x1)
    fmt.Println("x=",x)

    y:=3
    fmt.Println("y=",y)
    y1:=add2(&y)
    fmt.Println("y1 =",y1)
    fmt.Println("y=",y)

    z:=7
    getV(&z)

    man0:=Man{"wang",22}
    fmt.Println("before name:",man0.name)
    cName1(man0)
    fmt.Println("after name:",man0.name)

    man:=Man{"wang",22}
    fmt.Println("before name:",man.name)
    cName2(&man)
    fmt.Println("after name:",man.name)
}

func add(x int) int{
    return x+1;
}

func add2(x *int) int{
    *x=*x+1
    return *x;
}

func getV(x *int) {
    fmt.Println(*x)
}

func cName1(man Man){
    man.name="C1"
    fmt.Println("Processing Name:",man.name)
}

func cName2(man *Man){
    man.name="2"
    fmt.Println("Processing Name:",man.name)
}